/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.raitcon.hibernate.backbean;

import com.raitcon.hibernate.bean.Departamento;
import com.raitcon.hibernate.db.DepartamentoDB;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.bean.ViewScoped;

/**
 *
 * @author Mike
 */
@ManagedBean(name="departamentoBean")
@RequestScoped
public class DepartamentoBean {
    
   private List<Departamento>  departamentoList; 
    
    
     public void departamentoAllAction(ActionEvent event){
       String index = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("index");
       if (index!=null && index.length()>0){
           
           DepartamentoDB dptDB=new  DepartamentoDB();
            setDepartamentoList((List<Departamento>) dptDB.getDepartamentoByIdPais(index));
       }
    }

    /**
     * @return the departamentoList
     */
    public List<Departamento> getDepartamentoList() {
        return departamentoList;
    }

    /**
     * @param departamentoList the departamentoList to set
     */
    public void setDepartamentoList(List<Departamento> departamentoList) {
        this.departamentoList = departamentoList;
    }
}
